package com.springstart;

import org.springframework.beans.factory.FactoryBean;

public class PetFactoryBean implements FactoryBean<Pet> {
	
	private String petType;

	public String getPetType() {
		return petType;
	}

	public void setPetType(String petType) {
		this.petType = petType;
	}

	@Override
	public Pet getObject() throws Exception {
		if(petType.equals("dog"))
			return new Dog();
		if(petType.equals("cat"))
			return new Cat();
		else 
			return null;
	}

	@Override
	public Class getObjectType() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isSingleton() {
		// TODO Auto-generated method stub
		return false;
	}
	
}
